
import 'dart:async';
import '../utils/ApiService.dart';
import 'definitions/ResultUserRelationModel.dart';
import 'definitions/MomentSettingsParams.dart';


class UserRelationController {

    static String infoUsingGetPath = "/api/relation/info/{id}";
    /// 1. 根据ID获取用户关系
    static Future<ResultUserRelationModel> infoUsingGet(String id, [dynamic headers]) async {
      var response = await ApiService.get("/api/relation/info/$id", {}, headers);
      return ResultUserRelationModel()..fromJson(response.data);
    }
    
    static String followUsingPostPath = "/api/relation/follow/create/{id}";
    /// 2. 关注用户
    static Future<ResultUserRelationModel> followUsingPost(String id, [ dynamic headers ]) async {
      var response = await ApiService.post("/api/relation/follow/create/$id", null, headers);
      return ResultUserRelationModel()..fromJson(response.data);
    }
    
    static String cancelFollowUsingDeletePath = "/api/relation/follow/remove/{id}";
    /// 3. 取消关注用户
    static Future<ResultUserRelationModel> cancelFollowUsingDelete(String id, [dynamic headers]) async {
      var response = await ApiService.delete("/api/relation/follow/remove/$id", {}, headers);
      return ResultUserRelationModel()..fromJson(response.data);
    }
    
    static String setContactUsingPostPath = "/api/relation/contact/create/{id}";
    /// 4. 添加到通讯录
    static Future<ResultUserRelationModel> setContactUsingPost(String id, [ dynamic headers ]) async {
      var response = await ApiService.post("/api/relation/contact/create/$id", null, headers);
      return ResultUserRelationModel()..fromJson(response.data);
    }
    
    static String removeContactUsingDeletePath = "/api/relation/contact/remove/{id}";
    /// 5. 移除通讯录
    static Future<ResultUserRelationModel> removeContactUsingDelete(String id, [dynamic headers]) async {
      var response = await ApiService.delete("/api/relation/contact/remove/$id", {}, headers);
      return ResultUserRelationModel()..fromJson(response.data);
    }
    
    static String momentSettingsUsingPutPath = "/api/relation/moment/settings";
    /// 6. 动态设置
    static Future<ResultUserRelationModel> momentSettingsUsingPut(MomentSettingsParams data,[ dynamic headers ]) async {
      var response = await ApiService.put("/api/relation/moment/settings", data.toJson() , headers);
      return ResultUserRelationModel()..fromJson(response.data);
    }
    
}